OPC Studio User's Guide and Reference
OPC-A&E Attribute Dialog
Concepts > QuickOPC Concepts > QuickOPC Features > QuickOPC User Interface Features > OPC Common Dialogs > OPC-A&E Common Dialogs > OPC-A&E Attribute Dialog
In This Topic

General

Icon:

With AEAttributeDialog, your application can integrate a dialog box from which the user can select OPC-A&E event attributes:

The MultiSelect property determines whether the dialog allows the user to select multiple attributes as output.

Use the ServerDescriptor property to specify the OPC Alarms&Events server and the CategoryId property to specify the event category to be browsed. Then, call the ShowDialog method. If the result is equal to DialogResult.OK, the user has finished the selection, and information about it can be retrieved.

When the dialog is in single-select mode, you can obtain the information about the selected attribute from the AttributeElement or AttributeId property. When the dialog is in multi-select mode, the information about the selected categories is in the AttributeElements and AttributeIds properties.

Example

.NET

// This example shows how to let the user browse for an OPC Alarms&Events attribute.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System.Windows.Forms;
using OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing;

namespace FormsDocExamples._AEAttributeDialog
{
    static class ShowDialog
    {
        public static void Main1(IWin32Window owner)
        {
            var attributeDialog = new AEAttributeDialog
            {
                ServerDescriptor = {ServerClass = "OPCLabs.KitEventServer.2"},
                CategoryId = 0x00EC0001
            };

            DialogResult dialogResult = attributeDialog.ShowDialog(owner);
            if (dialogResult != DialogResult.OK)
                return;

            // Display results
            MessageBox.Show(owner, $"AttributeElement: {attributeDialog.AttributeElement}");
        }
    }
}
' This example shows how to let the user browse for an OPC Alarms&Events attribute.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing

Namespace FormsDocExamples._AEAttributeDialog
    Friend Class ShowDialog
        Shared Sub Main1(owner As IWin32Window)
            Dim attributeDialog = New AEAttributeDialog() With {
                .ServerDescriptor = New ServerDescriptor() With {
                    .ServerClass = "OPCLabs.KitEventServer.2"
                },
                .CategoryId = &HEC0001
            }

            Dim dialogResult As DialogResult = attributeDialog.ShowDialog(owner)
            If dialogResult <> DialogResult.OK Then
                Return
            End If

            ' Display results
            MessageBox.Show(owner, $"AttributeElement: {attributeDialog.AttributeElement}")
        End Sub
    End Class
End Namespace

Python

# This example shows how to let the user browse for an OPC Alarms&Events attribute.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from System.Windows.Forms import *
from OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing import *


attributeDialog = AEAttributeDialog()
attributeDialog.ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"
attributeDialog.CategoryId = 0x00EC0001

dialogResult = attributeDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
    exit()

# Display results.
print('AttributeElement: ', attributeDialog.AttributeElement, sep='')

 

Advanced

If you want to change the parameters of the client object the component uses to perform its OPC operations, you can use the ClientSelector Property.

 

See Also

Examples - Client User Interface